/********************************************
*
*
*
*  test_Box.c
*
*
********************************************/


#ifdef __cplusplus
 #if __cplusplus
  extern "C"{
 #endif
#endif /* __cplusplus */


#include "test_suite.h"
#include "d_box.h"


UINT32 TEST_BoxCreate_00()
{
    UINT32 ulRet;
    DMS_BOX_HAND_T ulHandle;

    ulRet = DMS_BoxRegionCreate("test_box_01", 0, 0xff, &ulHandle);

    CU_EQUAL(ulRet,DMS_INVALID_PARAM);

    return DMS_OK;
}

UINT32 TEST_BoxCreate_01()
{
    UINT32 ulRet;
    DMS_BOX_HAND_T ulHandle;

    ulRet = DMS_BoxRegionCreate(NULL, 10, 0xff, &ulHandle);

    CU_EQUAL(ulRet,DMS_INVALID_PARAM);

    return DMS_OK;
}

UINT32 TEST_BoxCreate_02()
{
    UINT32 ulRet;

    ulRet = DMS_BoxRegionCreate("test_box_02", 10, 0xff, NULL);

    CU_EQUAL(ulRet,DMS_INVALID_PARAM);

    return DMS_OK;
}

UINT32 TEST_BoxCreate_03()
{
    UINT32 ulRet;
    DMS_BOX_HAND_T ulHandle;

    ulRet = DMS_BoxRegionCreate("test_box_03", 10, 0xff, &ulHandle);

    CU_EQUAL(ulRet,DMS_OK);

    ulRet = DMS_BoxRegionDelete( ulHandle);

    CU_EQUAL(ulRet,DMS_OK);

    return DMS_OK;
}

UINT32 TEST_BoxWrite_00()
{
    UINT32 ulRet;
    DMS_BOX_HAND_T ulHandle;
    char  * aString;
    UINT32 i;

    aString = "abcffffffffsdfinlien";

    ulRet = DMS_BoxRegionCreate("test_box_01", 10, strlen(aString), &ulHandle);
    CU_EQUAL(ulRet,DMS_OK);

    ulRet = DMS_BoxRegionWrite( ulHandle, (VOID *)aString);
    CU_EQUAL(ulRet,DMS_OK);
    DMS_BoxRecordShow( ulHandle, 0, 0, 0);

    for(i=0;i<20;i++)
    {
        ulRet = DMS_BoxRegionWrite( ulHandle, (VOID *)aString);
        CU_EQUAL(ulRet,DMS_OK);
    }

    DMS_BoxRecordShow( ulHandle, 0, 0, 0);

    ulRet = DMS_BoxRegionDelete( ulHandle);
    CU_EQUAL(ulRet,DMS_OK);

    return DMS_OK;
}

UINT32 TEST_BoxWrite_01()
{
    UINT32 ulRet;
    DMS_BOX_HAND_T ulHandle;
    UINT32 uli;
    char  aString[255];

    ulRet = DMS_BoxRegionCreate("test_box_02", 10, 255, &ulHandle);
    CU_EQUAL(ulRet,DMS_OK);

    for(uli = 0 ; uli < 255; uli++ )
    {
        aString[uli] = (char)uli;
    }

    ulRet = DMS_BoxRegionWrite( ulHandle, (VOID *)aString);
    CU_EQUAL(ulRet,DMS_OK);
    DMS_BoxRecordShow( ulHandle, 0, 0, 0 );

    ulRet = DMS_BoxRegionDelete( ulHandle);
    CU_EQUAL(ulRet,DMS_OK);

    return DMS_OK;
}

UINT32 TEST_BoxWrite_02()
{
    return DMS_OK;
}

UINT32 TEST_BoxWrite_03()
{

    return DMS_OK;
}

UINT32 TEST_BoxShow_00()
{

    DMS_BoxInfoShow(0,0,0);
    DMS_BoxInfoShow(1,0,0);
    DMS_BoxInfoShow(1,0,0);

    return DMS_OK;
}

UINT32 TEST_BoxShow_01()
{

    return DMS_OK;
}

UINT32 TEST_BoxShow_02()
{

    return DMS_OK;
}

UINT32 TEST_BoxShow_03()
{

    return DMS_OK;
}

UINT32 TEST_BoxDelete_00()
{

    return DMS_OK;
}

UINT32 TEST_BoxDelete_01()
{

    return DMS_OK;
}

UINT32 TEST_BoxDelete_02()
{

    return DMS_OK;
}

UINT32 TEST_BoxDelete_03()
{

    return DMS_OK;
}

VOID TEST_BoxCreate()
{
    CU_EQUAL(TEST_BoxCreate_00(),DMS_OK);
    CU_EQUAL(TEST_BoxCreate_01(),DMS_OK);
    CU_EQUAL(TEST_BoxCreate_02(),DMS_OK);
    CU_EQUAL(TEST_BoxCreate_03(),DMS_OK);
}


VOID TEST_BoxWrite()
{
    CU_EQUAL(TEST_BoxWrite_00(),DMS_OK);
    CU_EQUAL(TEST_BoxWrite_01(),DMS_OK);
    CU_EQUAL(TEST_BoxWrite_02(),DMS_OK);
    CU_EQUAL(TEST_BoxWrite_03(),DMS_OK);
}


VOID TEST_BoxShow()
{
    CU_EQUAL(TEST_BoxShow_00(),DMS_OK);
    CU_EQUAL(TEST_BoxShow_01(),DMS_OK);
    CU_EQUAL(TEST_BoxShow_02(),DMS_OK);
    CU_EQUAL(TEST_BoxShow_03(),DMS_OK);
}


VOID TEST_BoxDelete()
{
    CU_EQUAL(TEST_BoxDelete_00(),DMS_OK);
    CU_EQUAL(TEST_BoxDelete_01(),DMS_OK);
    CU_EQUAL(TEST_BoxDelete_02(),DMS_OK);
    CU_EQUAL(TEST_BoxDelete_03(),DMS_OK);
}

VOID TEST_suite_Box(VOID)
{
    CU_pSuite suite;
    suite = CU_add_suite(__FUNCTION__, NULL, NULL);
    CU_ADD_TEST(suite, TEST_BoxCreate);
    CU_ADD_TEST(suite, TEST_BoxWrite);
    CU_ADD_TEST(suite, TEST_BoxShow);
    CU_ADD_TEST(suite, TEST_BoxDelete);
}

#ifdef __cplusplus
 #if __cplusplus
  }
 #endif
#endif /* __cplusplus */
